#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <cstdlib>
#include <stdlib.h>
#include <cstdio>
#include <cstdint>
#include <ctime>
#include <stack>
#include <string>
#include <queue>
#include <unistd.h>
#include <algorithm>

using namespace std;

//Definition for singly-linked list.
struct ListNode {
    int val;
    ListNode *next;
    ListNode(int x) : val(x), next(NULL) {}
};

class Solution {
public:
    vector<vector<int>> test;
    int findKthLargest(vector<int>& nums, int k) {
        int i;
        priority_queue<int, vector<int>, greater<int> > que;

        for (i = 0; i < k && i < nums.size(); i++){
            que.push(nums[i]);
        }
        for (; i < nums.size(); i++){
            que.push(nums[i]);
            que.pop();
        }
        return que.top();
    }
};

int main()
{
    Solution su;
    su.test.push_back({1 , 2 ,3 ,4 ,5, 0, 12, 4, 13, 14, 15});
   
    for (int i = 0; i < su.test.size(); i++){
        int  result = su.findKthLargest(su.test[i], 4);
        printf("the %dth result is %d\r\n", i, result);
    }

    return 0;
}